<{include file="public/header.html"}>
		<div class="xinsu-right">
			<div class="xinsu-right-content">
				<div class="xinsu-data-content">
					<div class="xinsu-title">
						<span class="layui-breadcrumb">
							<a><cite>当前位置</cite></a>
							<a><cite>被限制股票列表（<{$row["username"]}>）</cite></a>
						</span>
					</div>
					<div class="layui-form xinsu-form">
						<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label xinsu-form-label">股票代码</label>
								<div class="layui-input-block xinsu-input-block2">
								    <input type="text" name="code" value="" class="layui-input" placeholder=""/>
								</div>
						    </div>
							<button class="layui-btn xinsu-btn" onclick="add_frobid(0)">添加限制</button>
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						    <div class="layui-inline">
						    	<label class="layui-form-label xinsu-form-label">或者</label>
								<div class="layui-input-block xinsu-input-block2">
								    <input type="text" name="money" value="" class="layui-input" placeholder=""/>
								</div>
						    </div>
                            <div class="layui-inline"><label class="layui-form-label xinsu-form-label">亿元</label></div>
                            <button class="layui-btn xinsu-btn" onclick="add_frobid(1)">一键添加小盘股</button>
                            &nbsp;&nbsp;&nbsp;
							<span>记录总数：共 <{$total}> 条</span>
							<span onclick="delete_forbid('all')" class="xinsu-fontcolor-blue">解除所有限制</span>
						</div>
					</div>
					<div class="layui-form xinsu-form">
						<table class="layui-table">
							<thead>
								<tr>
									<th>股票代码</th>
									<th>股票名称</th>
									<th>添加时间</th>
									<th>操作</th>
								</tr> 
							</thead>
							<tbody>
								<{if empty($list) == false}>
								<{foreach $list as $val}>
								<tr>
									<td><{$val.code}></td>
									<td><{$val.name}></td>
									<td><{$val.addtime}></td>
									<td>
                                        <a class="xinsu-fontcolor-blue" onclick="delete_forbid('<{$val.code}>')" href="javascript:;">删除</a>
									</td>
								</tr>
								<{/foreach}>
								<{else}>
								<tr>
									<td colspan="4">该用户没有被单独禁止的股票!</td>
								</tr>
								<{/if}>
							</tbody>
						</table>
					</div>
					<div class="xinsu-page">
						<div class="xinsu-show">
							<{$page}>
						</div>
						<div class="xinsu-clear"></div>
					</div>
				</div>
			</div>
		</div>
		<script>
            //新增限制股票
            function add_frobid(type) {
                var code = money = "";
                if (type == 0) {
                    code = $("input[name='code']").val();
                    if (code == "") { 
                        layer.msg("股票代码不能为空！");return false;
                    } 
                } else {
                    money = $("input[name='money']").val();
                    if (money == "") { 
                        layer.msg("请输入限定市值！");return false;
                    }
                }

                layer.confirm('您确定要新增限制股票？', {icon: 3}, function () {
					var url = "/user/ajax_add_forbid";
					layer.closeAll();
					http_request_post(url, {type:type, code:code, money:money, uid:"<{$row.id}>"}, function(res) {
						layer.msg(res.msg, {icon: 1, time: 1000}, function () {
							location.reload();
						});
					});
				});
            }
            
            //删除限制列表
			function delete_forbid(code) {
				layer.confirm('您确定要删除限制股票？', {icon: 3}, function () {
					var url = "/user/ajax_delete_forbid";
					layer.closeAll();
					http_request_post(url, {code:code, uid:"<{$row.id}>"}, function(res) {
						layer.msg(res.msg, {icon: 1, time: 1000}, function () {
							location.reload();
						});
					});
				});
			}
		</script>
<{include file="public/footer.html"}>
